/**
 * @file
 *           base64.h
 * @brief
 *          <fillin>purpose
 *
 * @par Author (last changes):
 *          - Herea Adrian
 *          
 * @par Description:
 *
 *
 * @par Module-History:
 * @verbatim
 *  Date        Author				Reason
 *  15.01.2010  Herea Adrian         Initial creation
 *
 * @endverbatim
 *
 * @par Copyright Notice:
 * @verbatim
 * Copyright (C) 2010
 * All Rights Reserved.
 * The reproduction, transmission or use of this document or its contents is
 * not permitted without express written authority.
 * Offenders will be liable for damages. All rights, including rights created
 * by patent grant or registration of a utility model or design, are reserved.
 **/
#include "stdafx.h"
#include "Param.h"

namespace protocol
{
	Param::Param()
	{
	}

  Param::Param(string sName, string sVal) :
    m_sName(sName), m_sVal(sVal)
  {
  }

  string
  Param::getValue()
  {
    return m_sVal;
  }

  void
  Param::setValue(string sVal)
  {
    m_sVal = sVal;
  }

  string
  Param::getName()
  {
    return m_sName;
  }

  void
  Param::setName(string sName)
  {
    m_sName = sName;
  }

  INT
  Param::ToInt32() const
  {
    INT value = 0;
    CHAR* endPtr;

    value = strtol(m_sVal.c_str(), &endPtr, 0);
    if (*endPtr)
      {
        value = 0;
      }

    return value;
  }

  DWORD
  Param::ToUInt32() const
  {
    DWORD value = 0;
    CHAR* endPtr;

    value = strtoul(m_sVal.c_str(), &endPtr, 0);
    if (*endPtr)
      {
        //wrong number
        value = 0;
      }
    return value;
  }

  Param::~Param(void)
  {
  }
}
